package com.retrofit.server.processor.entity;

import com.retrofit.server.processor.AnnotationProcessor;
import com.retrofit.server.processor.StringUtils;
import java.util.List;

/**
 * @author YLG
 * @Datetime 2020/5/8-10:25 PM
 * @Version v1.0
 * @description 方法类
 */
public class MethodEntity {
  
  private String javaDoc;

  /**方法名**/
  private String methodName;

  /**修饰符*/
  private int[] modifiers;

  /**
   * 参数集
   * */
  private List<ParameterEntity> mParameterEntityList;

  /**
   * 方法体
   */
  private MethodCodeBlockEntity mMethodBodyEntity;

  /**返回类*/
  private MethodReturnEntity mReturnEntity;
  
  /**不做生成*/
  private MethodAnnotationEntity mMethodAnnotationEntity;








  
  public String getJavaDoc() {
    return javaDoc;
  }
  
  public void setJavaDoc(String javaDoc) {
    this.javaDoc = javaDoc;
  }
  
  public MethodAnnotationEntity getMethodAnnotationEntity() {
    return mMethodAnnotationEntity;
  }
  
  public void setMethodAnnotationEntity(MethodAnnotationEntity methodAnnotationEntity) {
    mMethodAnnotationEntity = methodAnnotationEntity;
  }
  
  public String getMethodName() {
    return methodName;
  }
  
  public void setMethodName(String methodName) {
    this.methodName = methodName;
  }
  
  public int[] getModifiers() {
    return modifiers;
  }
  
  public void setModifiers(int[] modifiers) {
    this.modifiers = modifiers;
  }
  
  public List<ParameterEntity> getParameterEntityList() {
    return mParameterEntityList;
  }
  
  public void setParameterEntityList(List<ParameterEntity> parameterEntityList) {
    mParameterEntityList = parameterEntityList;
  }
  
  public MethodCodeBlockEntity getMethodBodyEntity() {
    return mMethodBodyEntity;
  }
  
  public void setMethodBodyEntity(MethodCodeBlockEntity methodBodyEntity) {
    mMethodBodyEntity = methodBodyEntity;
  }
  
  public MethodReturnEntity getReturnEntity() {
    return mReturnEntity;
  }
  
  public void setReturnEntity(MethodReturnEntity returnEntity) {
    mReturnEntity = returnEntity;
  }
  
  
  public String getParameterNames(){
    StringBuilder sb=new StringBuilder("");
    if(!StringUtils.isListNull(mParameterEntityList)){
      for (ParameterEntity parameter : mParameterEntityList) {
        //过滤handler 参数
        if(!AnnotationProcessor.HANDLER_PARAM_NAME.equals(parameter.getParamName())){
          sb.append(parameter.getParamName()).append(",");
        }
      }
      if(sb.length()>1){
        return sb.substring(0,sb.length()-1);
      }
    }
    return "";
  }
  
}
